<template>
  <div class="card">
    <div class="box">
      <div class="box-top">
        <div class="title">
          <div class="left">数据看板</div>
          <div class="right">
            <a-button type="link" @click= "goback()">查看更多</a-button>
          </div>
        </div>
        <div style="margin:10px 35px 0;">监护项目</div>
      </div>
      <div class="content">
        <div class="item-box">
          <div class="item">
            <div class="center-box">
              <div class="num num1">{{sum2}}</div>
              <div class="text">数据告警</div>
            </div>
          </div>
          <div class="item">
            <div class="center-box">
              <div class="num num2">{{getverify2}}</div>
              <div class="text">已核实数据</div>
            </div>
          </div>
          <div class="item">
            <div class="center-box">
              <div class="num num3">{{parNum2}}</div>
              <div class="text">告警项目</div>
            </div>
          </div>
        </div>
        <div style="padding:50px 35px 15px;border-bottom:1px solid #eee;">监测项目</div>
        <div class="item-box">
          <div class="item">
            <div class="center-box">
              <div class="num num1">{{sum}}</div>
              <div class="text">数据告警</div>
            </div>
          </div>
          <div class="item">
            <div class="center-box">
              <div class="num num2">{{getverify}}</div>
              <div class="text">已核实数据</div>
            </div>
          </div>
          <div class="item">
            <div class="center-box">
              <div class="num num3">{{parNum}}</div>
              <div class="text">告警项目</div>
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>
<script>
import { Donut } from "@antv/g2plot";
import { getTop } from '@/request/newApi'
export default {
  props: {},
  data() {
    return {
      btnActive: 1,
      sum: undefined, // 数据告警数
      getverify: undefined, // 已核实
      parNum: undefined, // 告警项目数
      sum2: undefined, // 数据告警数
      getverify2: undefined, // 已核实
      parNum2: undefined, // 告警项目数
      // typeNum: 2
    };
  },
  components: {},
  created() {
    this.getTop();
  },
  mounted() {
  },
  methods: {
    // 数据告警
    // 监测数据
    async getTop(){
      let { data } = await getTop({
        monitorType: 1
      });
      console.log(data)
      if(data.code === 200 ){
        console.log('111')
        this.sum = data.result.sum;
        this.getverify = data.result.getverify;
        this.parNum = data.result.parNum
      }
      // 监护数据
      let res = await getTop({
        monitorType: 2
      });
      console.log(res)
      if(res.data.code === 200 ){
        console.log('666')
        this.sum2 = res.data.result.sum;
        this.getverify2 = res.data.result.getverify;
        this.parNum2 = res.data.result.parNum
      }
    },
    goback(){
      this.$router.push("/data_dataList")
    }
  }, 
};
</script>
<style lang="less" scoped>
@import "~@/assets/css/base.less";
.box {
  background: #fff;
  border-top: 1px solid transparent;
  height: 500px;
  margin-bottom: 20px;
  .box-top {
    height: 85px;
    border-bottom: 1px solid #eee;
    .title {
      margin: 10px 15px 0;
      display: flex;
      justify-content: space-between;
    }
  }
  .item-box{
    display: flex;
    padding-top:55px;
    .item{
      flex-grow: 1;
      display: flex;
      justify-content: center;
      .center-box{
        text-align: center;
        .num{
          font-size:25px;
          font-weight: bold;
        }
        .num1{
          color:#ff5733;
        }
        .num2{
          color:#00baad;
        }
        .num3{
          color:@c1;
        }
        .text{
          margin-top:15px;
        }
      }
    }
  }
}
</style>